﻿@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment
@{
    //ViewBag.Title = "欢迎使用 SiE-智慧企业平台";
    Layout = "~/Views/Shared/_Layout.cshtml";

    OperatorInfo operatorInfo = ViewBag.OperatorInfo;
    String portrait = operatorInfo.Portrait;
    if (portrait == null || string.IsNullOrEmpty(portrait))
    {
        portrait = Url.Content("~/image/portrait.png");
    }
    else
    {
        portrait = GlobalContext.SystemConfig.ApiSite + portrait;
    }
}
@BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/yisha/js/yisha-data.min.js"))

<div id="wrapper">
    <!--左侧导航开始-->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="nav-close">
            <i class="fa fa-times-circle"></i>
        </div>

        <div class="sidebar-collapse">
            <ul class="nav" id="side-menu">
                <li class="logo" style="left:auto" >
                    <img src="~/image/AppLog.png" href ="www.sohu.com" class="img-circle fa fa-apple left  " height="25" width="25" > Sie-智慧企业2.0
                </li>
                <!--<li class="nav-header">
                <div class="dropdown profile-element clear">-->
                @*<div class="image-left">
                    <img alt="image" src='@portrait' class="img-circle" height="25" width="25" />
                </div>*@
                @*<div class="image-right">
                    <span class="block m-t-xs">@operatorInfo.UserName</span>
                    <span class="text-xs block">@operatorInfo.DepartmentName</span>
                </div>*@
                <!--</div>
            </li>-->
                @{ List<MenuEntity> menuList = ViewBag.MenuList;
                    foreach (MenuEntity menu in menuList.Where(p => p.ParentId == ViewBag.FunctionID).OrderBy(p => p.MenuSort))
                    {
        <li data-type="menu">
            @{ if (HttpHelper.IsUrl(menu.MenuUrl))
                {
    <a class="menuItem" href="@menu.MenuUrl">
        <i class="@menu.MenuIcon"></i>
        <span class="nav-label">@menu.MenuName</span>
    </a> }
else
{
    <a href="#">
        <i class="@menu.MenuIcon"></i>
        <span class="nav-label">@menu.MenuName</span>
        <span class="fa arrow"></span>
    </a> } }
            <ul class="nav nav-second-level collapse" data-type="menu">
                @foreach (MenuEntity secondMenu in menuList.Where(p => p.ParentId == menu.Id).OrderBy(p => p.MenuSort))
                {
    <li data-type="menu">
        @{ if (menuList.Where(p => p.ParentId == secondMenu.Id && p.MenuType != (int)MenuTypeEnum.Button).Count() == 0)
            {
                if (HttpHelper.IsUrl(secondMenu.MenuUrl))
                {
    <a class="menuItem" href='@secondMenu.MenuUrl'>@secondMenu.MenuName</a> }
else
{
    <a class="menuItem" href="#" data-url='@Url.Content("~/" + secondMenu.MenuUrl)'>@secondMenu.MenuName</a> }
}
else
{
    <a href="#">@secondMenu.MenuName<span class="fa arrow"></span></a>
                            <ul class="nav nav-third-level" data-type="menu">
                                @foreach (MenuEntity thirdMenu in menuList.Where(p => p.ParentId == secondMenu.Id).OrderBy(p => p.MenuSort))
                                {
        <li data-type="menu">
            <a class="menuItem" href="#" data-url='@Url.Content("~/" + thirdMenu.MenuUrl)'>@thirdMenu.MenuName</a>
        </li>
}
                            </ul> } }
    </li>
}
            </ul>
        </li>
 } }
            </ul>
        </div>

    </nav>
    
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <a class="navbar-minimalize minimalize-styl-2" href="#" title="收起菜单">
                    <i class="fa fa-bars"></i>
                </a>
              
            <ul class="nav navbar-top-links navbar-right welcome-message" style="font:100">
                <li><i style="margin-right:10px" class="fa fa-search"></i><input style="padding-left:5px;border-radius: 9px;width:150px" type="text" placeholder="请输入查询内容..." title="查找系统功能" ></li>
                <li><a class="" title="IMES-智能制造执行" href="/home/index?id=1" ><i class="fa fa-cubes"></i>智造</a></li>
                <li><a class="" title="ERP-企业资源计划" href="/home/index?id=2"><i class="fa fa-support"></i>运营</a></li>
                <li><a id="BasicData" title="CRM-客户关系管理" href="/home/index?id=3"><i class="fa fa-cloud-upload"></i>客户</a></li>
                <li><a id="BasicData" title="SRM-供应商关系管理" href="/home/index?id=4"><i class="fa fa-snapchat"></i>供应商</a></li>
                <li><a id="BasicData" title="EHR-人力资源管理" href="/home/index?id=5"><i class="fa fa-male"></i>员工</a></li>
                <li><a id="BasicData" title="FCP-财务预算和资金" href="/home/index?id=6"><i class="fa fa-money"></i>资金</a></li>
                <li><a id="BasicData" title="PLM-产品生命周期" href="/home/index?id=7"><i class="fa fa-barcode"></i>产品</a></li>
                <li><a id="BasicData" title="OA-企业协同办公" href="/home/index?id=8"><i class="fa fa-random"></i>流程</a></li>
                <li><a id="BasicData" title="BI-企业信息中心" href="/home/index?id=9"><i class="fa fa-bar-chart"></i>分析</a></li>
                
                <li>
                    <button id="Config" class="btn btn-default btn-circle menuItem btn-sm" style="width:25px;height:25px" type="button" title="SYS-系统平台管理" href="/home/index?id=100" target="_parent" >
                        <i class="fa fa-cogs"  ></i>
                    </button>
                </li>
                <li>
                    <button id="fullScreen" class="btn btn-default btn-circle btn-sm" style="width:25px;height:25px" type="button" title="全屏显示">
                        <i class="fa fa-arrows-alt"></i>
                    </button>
                </li>
                @*<li><a id="fullScreen" title="全屏显示模式"><i class="fa fa-arrows-alt"></i></a></li>*@
                <li class="dropdown user-menu">
                    <a href="javascript:void(0)" class="dropdown-toggle" data-hover="dropdown">
                        <img src="~/image/user.png" class="user-image">
                        <span class="hidden-xs">@operatorInfo.RealName</span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="mt5">
                            <a class="menuItem" href="#" data-url='@Url.Content("~/OrganizationManage/User/UserDetail")?id=@operatorInfo.UserId'>
                                <i class="fa fa-user"></i> 个人中心
                            </a>
                        </li>
                        <li>
                            <a onclick="showChangePasswordForm()">
                                <i class="fa fa-key"></i> 修改密码
                            </a>
                        </li>
                        <li>
                            <a onclick="showChangePasswordForm()">
                                <i class="fa fa-male"></i> 实时消息
                            </a>
                        </li>

                        <li>
                            <a onclick="showSwitchSkinForm()">
                                <i class="fa fa-dashboard"></i> 切换主题
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="@Url.Content("~/Home/LoginOff")">
                                <i class="fa fa-sign-out"></i> 退出登录
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
            </nav>
        </div>
        <div class="row content-tabs">
            <button class="roll-nav roll-left tabLeft">
                <i class="fa fa-backward"></i>
            </button>
            <nav class="page-tabs menuTabs">
                <div class="page-tabs-content">
                    <a href="javascript:;" class="active menuTab" data-id="/system/main">首页</a>
                </div>
            </nav>
            <button class="roll-nav roll-right tabRight">
                <i class="fa fa-forward"></i>
            </button>
            <div class="btn-group roll-nav roll-right">
                <button class="dropdown J_tabClose" data-toggle="dropdown">
                    页签操作<span class="caret"></span>
                </button>
                <ul role="menu" class="dropdown-menu dropdown-menu-right">
                    <li><a class="tabCloseCurrent" href="#">关闭当前</a></li>
                    <li><a class="tabCloseOther" href="#">关闭其他</a></li>
                    <li><a class="tabCloseAll" href="#">全部关闭</a></li>
                </ul>
            </div>
            <a href="#" class="roll-nav roll-right tabReload"><i class="fa fa-refresh"></i> 刷新</a>
        </div>
        <div class="row mainContent" id="content-main">
            <iframe class="YiSha_iframe" name="iframe0" width="100%" height="100%" data-id="/system/main" src="@Url.Content("~/Home/Welcome")" frameborder="0" seamless></iframe>
        </div>
    </div>
    <!--右侧部分结束-->
</div>

<script type="text/javascript">
    if (!ys.isNullOrEmpty($.cookie('Skin'))) {
        var skin = decodeURIComponent($.cookie('Skin'));
        $("body").addClass(skin.split('|')[0]);
        $("body").addClass(skin.split('|')[1]);
    } else {
        var sideTheme = "theme-dark";
        var skinName = "skin-blue";
        $("body").addClass(sideTheme);
        $("body").addClass(skinName);
    }

    function showChangePasswordForm() {
        ys.openDialog({
            title: "修改密码",
            content: '@Url.Content("~/OrganizationManage/User/ChangePassword")' + '?id=@operatorInfo.UserId',
            height: "500px",
            callback: function (index, layero) {
                var iframeWin = window[layero.find('iframe')[0]['name']];
                iframeWin.saveForm(index);
            }
        });
    }

    function showSwitchSkinForm() {
        ys.openDialog({
            title: "切换主题",
            content: '@Url.Content("~/Home/Skin")',
            width: '530px',
            height: '390px',
            btn: null,
            maxmin: false
        });
    }
</script>
